<!DOCTYPE HTML>
<html>
<head>
    <title>实用工具 | xiaohe66</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <link href="../plugin/layui/css/layui.css" rel="stylesheet" type="text/css"/>
    <style>

        #body {
            padding-left: 200px;
            left: 0;
            bottom: 0;
        }

        .layui-tab-content {
            position: absolute;
            left: 200px;
            right: 0;
            bottom: 0;
            top: 0;
            padding: 0;
            overflow: hidden;
        }

        .layui-tab-item {
            height: 100%;
        }

        #home {
            cursor: pointer;
        }

    </style>
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
    <div class="layui-header">
        <div class="layui-logo" id="home">xiaohe66</div>
        <!-- 头部区域（可配合layui已有的水平导航） -->
        <ul class="layui-nav layui-layout-left">
        </ul>
        <ul class="layui-nav layui-layout-right">
        </ul>
    </div>

    <div class="layui-side layui-bg-black">
        <div class="layui-side-scroll">
            <ul class="layui-nav layui-nav-tree" lay-filter="menu" id="menu">
                <li class="layui-nav-item layui-nav-itemed">
                    <a href="javascript:">实用工具</a>
                    <dl class="layui-nav-child">
                        <dd link="./form.html"><a href="javascript:">表单工具</a></dd>
                        <dd link="http://www.baidu.com"><a href="javascript:">百度</a></dd>
                    </dl>
                </li>
            </ul>
        </div>
    </div>

    <div class="layui-body" id="body">
        <!-- 内容主体区域 -->
        <div class="layui-tab-content">
            <iframe src="../about.html" width="100%" height="100%" frameborder="no" border="0" marginwidth="0"
                    marginheight="0"></iframe>
        </div>
    </div>

</div>
<script type="text/javascript" src="../plugin/layui/layui.js"></script>
<script>
    //JavaScript代码区域
    layui.use('element', function () {
        let element = layui.element;

        $ = layui.jquery;
        element.render('nav');

        element.on('nav(menu)', function (elem) {
            let dd = elem.parent();
            let link = dd.attr('link');
            if (!link) return;
            layui.$("#body iframe").attr("src", link);
        });

    });
</script>
</body>
</html>